package com.rocky.project.service;

import java.util.Collection;

import org.apache.log4j.Logger;

import com.rocky.project.model.admin.AdminUser;
import com.rocky.project.mvc.WebApplicationInitListener;


public class ProjectInitServiceImpl extends BaseServiceImpl  implements ProjectInitService {
	private final static Logger log = Logger.getLogger(WebApplicationInitListener.class);
	public void initData() throws Exception {
		Collection collection=this.executeHqlNoParam(" SELECT m FROM AdminUser AS m WHERE m.deleted = false and m.username='admin' ", 0, null);
		if(collection==null || collection.isEmpty()){
			log.info("#ProjectInitServiceImpl->initData#:collection is not null ");
			AdminUser adminUser = new AdminUser();
			adminUser.setUsername("admin");
			adminUser.setPassword("admin");
			adminUser.setType("AdminUser");
			this.create(adminUser);
		}		
	}



}
